<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/views/common/include/taglib.jsp"%>
<style type="text/css">
em {
	border-right: 1px solid #565252;
	margin-right: 3px;
}
</style>
<section>
	<div style="height: 40px; line-height: 40px;">
		<div class="forword_area"></div>
		<div class="location">当前位置：${sessionScope.currcent_position}</div>
	</div>
	<hr>
	<section>
		<!--begin 搜索栏 -->
		<div class="panel">
			<div style="float: left; height: 28px; width: 150px;">
				<input id="orderNumber" type="text" maxlength="20"
					value="${(not empty orderNumber)? orderNumber : ''  }"
					class="input-sm" placeholder="订单号">&nbsp;&nbsp;
			</div>
			&nbsp;
			<!-- <label>订单类型：</label> -->
			<div class="btn-group">
				<select id="state" name="infoType" class="dropdown-menu">
					<option value="-1"
						<c:if test="${state == -1 }">selected="selected"</c:if>>订单类型</option>
					<option value="6"
						<c:if test="${state == 6 }">selected="selected"</c:if>>退款申请</option>
					<option value="7"
						<c:if test="${state == 7 }">selected="selected"</c:if>>退款已确认</option>
					<option value="8"
						<c:if test="${state == 8 }">selected="selected"</c:if>>退款已完成</option>
					<option value="9"
						<c:if test="${state == 9 }">selected="selected"</c:if>>退款已拒绝</option>
					<option value="10"
						<c:if test="${state == 10 }">selected="selected"</c:if>>退货申请</option>
					<option value="11"
						<c:if test="${state == 11 }">selected="selected"</c:if>>退货已确认</option>
					<option value="12"
						<c:if test="${state == 12 }">selected="selected"</c:if>>退货已完成</option>
					<option value="13"
						<c:if test="${state == 13 }">selected="selected"</c:if>>退货已拒绝</option>
				</select>
			</div>
			&nbsp;
			<!-- <label>起始时间：</label> -->
			<input id="beginDate" type="text" maxlength="6"
				class="input-sm form-control"
				onClick="WdatePicker({maxDate:'2099-12-31 23:59:59'})"
				value="${beginDate}" placeholder="起始时间">&nbsp;&nbsp;
			<!-- <label>结束时间：</label> -->
			<input id="endDate" type="text" maxlength="20"
				class="input-sm form-control"
				onClick="WdatePicker({maxDate:'2099-12-31 23:59:59'})"
				value="${endDate}" placeholder="结束时间">&nbsp;&nbsp;
				
			<div class="btn-group">
				<select class="dropdown-menu" id="pSize">
					<c:forEach items="${pageSizes }" var="item">
						<option value="${item.value }"
							<c:if test="${pSize == item.value }">selected</c:if>>&nbsp;&nbsp;&nbsp;${item.label }</option>
					</c:forEach>
				</select>
			</div>
			<div class="form-control">
				<div class="search" onclick="getInfoList();">
					<img src="${ctx }/images/table/search_second.png">
				</div>
				<%-- <div class="delete" style="float: left;" onclick="deleteByIds();">
					<img src="${ctx }/images/table/del_second.png">
				</div> --%>
				<!-- <div style="width:45px;height:25px;margin-left:10px;padding-top:3px;padding-left:10px;background-color:#37ced4;
                            color:white;cursor: pointer;float:left;" onclick="exportExcel();">导出</div> -->
			</div>
		</div>
		<!--end 搜索栏 -->

		<!--begin table表格 -->
		<div>
			<div>
				<table class="table">
					<thead>
						<tr>
							<th width="3%"><img id="all" onclick="selectAll(this)"
								src="${ctx }/images/tables/wugou.png"
								style="margin-bottom: 1px;"></th>
							<th width="5%">序号</th>
							<th width="8%">订单号</th>
							<th width="8%">订单总金额</th>
							<th width="8%">用户号</th>
							<th width="8%">订单类型</th>
							<th width="8%">订单状态</th>
							<th width="10%">操作</th>
						</tr>
					</thead>
					<tbody id="tableTbody">
						<c:forEach items="${orderInfos.list }" var="orderInfo"
							varStatus="orderInfoStatus">
							<tr onmouseover="mouseoverOne(this)"
								onmouseout="mouseoutOne(this)">
								<td><img id="order${orderInfo.id}" name="cellChecked"
									class="${orderInfo.id}"
									onclick="selectOne('${orderInfo.id}',this)"
									src="${ctx }/images/tables/wugou.png"></td>
								<td>${orderInfoStatus.index + 1 }</td>
								<td>${orderInfo.orderNumber}</td>
								<td>${orderInfo.finalPrice}元</td>
								<td>${orderInfo.userAccount}</td>
								<%--  <td> <fmt:formatDate type="date" pattern="yyyy-MM-dd HH:mm:ss" value="${orderInfo.createTime}"/> </td> --%>
								<td><c:choose>
										<c:when test="${orderInfo.type == 1}">正常订单</c:when>
										<c:when test="${orderInfo.type == 2}">积分订单</c:when>
										<c:when test="${orderInfo.type == 3}">秒杀订单</c:when>
									</c:choose></td>
								<td><c:if test="${orderInfo.type == 1}">
										<c:choose>
											<c:when test="${orderInfo.state == 0}">待付款</c:when>
											<c:when test="${orderInfo.state == 1}">待确认</c:when>
											<c:when test="${orderInfo.state == 2}">待发货</c:when>
											<c:when test="${orderInfo.state == 3}">配送中</c:when>
											<c:when test="${orderInfo.state == 4}">已完成</c:when>
											<c:when test="${orderInfo.state == 5}">已取消</c:when>
											<c:when test="${orderInfo.state == 6}">退款申请</c:when>
											<c:when test="${orderInfo.state == 7}">退款已确认</c:when>
											<c:when test="${orderInfo.state == 8}">退款已完成</c:when>
											<c:when test="${orderInfo.state == 9}">退款已拒绝</c:when>
											<c:when test="${orderInfo.state == 10}">退货申请</c:when>
											<c:when test="${orderInfo.state == 11}">退货已确认</c:when>
											<c:when test="${orderInfo.state == 12}">退货已完成</c:when>
											<c:when test="${orderInfo.state == 13}">退货已拒绝</c:when>
											<c:when test="${orderInfo.state == 14}">配送已送达</c:when>
										</c:choose>
									</c:if></td>
								<td><a class="fa fa-check " title="详情" onclick="detailorderInfo('${orderInfo.id}');">详情</a>
									<c:if test="${orderInfo.type == 2 || orderInfo.type == 3}">
										<c:if test="${orderInfo.state == 1 || orderInfo.state == 2}">
											<a class="fa fa-check " title="发货"onclick="sendGoods('${orderInfo.id}');">| 发货</a>
										</c:if>
									</c:if>
									<c:if test="${orderInfo.type == 1}">
										<c:if test="${orderInfo.state == 7}">
											<a class="fa fa-check " title="退款完成"onclick="completeRefund('${orderInfo.id}');">| 退款完成</a>
										</c:if>
										<c:if test="${orderInfo.state == 11}">
											<a class="fa fa-check " title="退货完成"onclick="completeReturn('${orderInfo.id}');">| 退货完成</a>
										</c:if>
									</c:if>
									</td>
							</tr>
						</c:forEach>
					</tbody>

					<tfoot>
						<tr>
							<td colspan="10">
								<div>
									<div style="float: left;">
										<span class="total">合计 ${orderInfos.total} 条数据</span> <input
											type="hidden" value="${orderInfos.total}" id="total">
									</div>
									<div style="float: right; margin-right: 10px; margin-top: 29px">
										<div style="float: left;">
											<ul class="footer_ul">
												<c:if test="${orderInfos.hasPreviousPage }">
													<li onclick="gotoPage(${currentPage-1 });"><a
														style="color: #37CED4">&lt;&lt;</a></li>
												</c:if>
												<c:if test="${orderInfos.firstPage > 1}">
													<li onclick="gotoPage(1);"
														style="border: 1px solid #9A9A9A;"><a>1</a></li>
													<c:if test="${orderInfos.firstPage > 2}">
                                                ...
                                            </c:if>
												</c:if>
												<c:forEach items="${orderInfos.navigatepageNums }"
													var="page">
													<li onclick="gotoPage(${page});"
														class="<c:if test="${currentPage == page }">active</c:if>"
														style="border: 1px solid #9A9A9A;"><a>${page}</a></li>
												</c:forEach>
												<c:if test="${orderInfos.lastPage < orderInfos.pages}">
													<c:if test="${orderInfos.firstPage < orderInfos.pages - 1}">
                                                ...
                                            </c:if>
													<li onclick="gotoPage(${orderInfos.pages});"
														style="border: 1px solid #9A9A9A;"><a>${orderInfos.pages}</a>
													</li>
												</c:if>
												<c:if test="${orderInfos.hasNextPage }">
													<li><a onclick="gotoPage(${currentPage+1});"
														style="color: #37CED4">&gt;&gt;</a></li>
												</c:if>
											</ul>
										</div>
										<div style="float: left; height: 30px;">
											<span style="color: #9A9A9A;">跳转到</span> <input
												class="inputclass" id="pageNo"
												onkeydown="if(event.keyCode==13){event.keyCode=0;return false;}"
												type="text" value="${currentPage }"
												style="width: 26px; height: 28px"onkeyup = "checInputNum(this)"> <span
												style="color: #9A9A9A;">页</span> <span class="buttonclass"
												id="J_JumpTo" onclick="gotoInfoPage(page);"><a>GO</a></span>
										</div>
									</div>
								</div>
							</td>
						</tr>
					</tfoot>
				</table>

			</div>
			<div style="width: 35%; float: right;"></div>
		</div>
		<%@include file="/views/common/footer.jsp"%>
	</section>
</section>

<script type="text/javascript">
		var ctx = '${ctx}';
		setCtx(ctx);
		
		//实现选中取消切换图片
		$("tbody td>img").toggle(function(){    
		    $(this).attr("src","${ctx }/images/tables/honggou.png"); 
		    //$(this).parents("tr").children().each(function(){
			   // $(this).css("background","#D3F0F1");
		   //});    
		},function(){    
		    $(this).attr("src", "${ctx }/images/tables/wugou.png"); 
		    //$(this).parents("tr").children().each(function(){
			    //$(this).css("background","");
		   //});
		    });
		    
		//实现全选切换所有选项图标
		$("#all").toggle(function(){    
		    $(this).attr("src","${ctx }/images/tables/honggou.png"); 
		    $("tbody td>img").attr("src","${ctx }/images/tables/honggou.png");  
		},function(){    
		    $(this).attr("src", "${ctx }/images/tables/wugou.png"); 
		    $("tbody td>img").attr("src","${ctx }/images/tables/wugou.png");  
		    });
		function setCtx(ctx){
		    this.ctx = ctx;
		}
</script>
<script
	src="${ctx}/js/controllers/mall/orderinfo/orderInfoListController.js"
	type="text/javascript"></script>
<!-- 解决ie 6 7 8 9不能显示placeholder的问题 -->
<script src="${ctx}/js/lib/jquery.JPlaceholder.js"></script>